import requests
class urls:
    def doc(self, url, port=None,n=10):
        """
        爬取单篇文章内容
        :param port: 端口
        :param url: 地址
        :param n: 访问次数
        :return: 请求结果
        """
        n = int(n) + 1
        if port:
            url = f"{url}:{port}"
        for i in range(1, int(n)):
            gets = requests.get(url=url)
            if int(gets.status_code) == int(200):
                print(f"第[ {i} ]次访问成功")
            else:
                print(f"第[ {i} ]次访问失败")

up = urls()
up.doc(url='http://baidu.com', n=5)